<template>
  <div class="header">
    <div class="header-left">
      <img src="../assets/img/logo.png" />
      <i class="iconfont" @click="TOGGLE_SIDEBAR" :class="!sidebar ? 'icon-foldLeft' : 'icon-foldRight'"></i>
    </div>
    <div class="header-right">
      <span>{{ username }}({{type==1?"超级管理员":"普通管理员"}})</span>
      |
      <img src="../assets/img/gita.gif"/>
      <span @click="LogoutAction">退出登录</span>
      <img src="../assets/img/cn.png"/>
    </div>
  </div>
</template>

<script>
import { mapMutations, mapActions,mapGetters } from "vuex";
export default {
  name: "MyHeader",
  methods: {
    ...mapMutations(["TOGGLE_SIDEBAR"]),
    ...mapActions(["LogoutAction"]),
  },
  computed:{
    ...mapGetters(["sidebar", "username", "type"]),
  },
};
</script>

<style scoped lang="scss">
.header {
  height: 50px;
  background: lightskyblue;
  line-height: 50px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .header-left {
    height: 35px;
    display: flex;
    align-items: center;
    i{
      padding-left: 30px;
    }

    img {
      width: 104px;
      margin-left: 20px;
    }
  }

  .header-right {
    img:nth-of-type(1) {
      height: 35px;
      margin-left: 5px;
      vertical-align:middle;

    }

    img:nth-of-type(2) {
      height: 50px;
      vertical-align:middle;
    }
    span{
      vertical-align:middle;
      margin-left: 5px;
      margin-right: 5px;
    }
  }
}
</style>